package Test;

import java.util.Arrays;

public class Test04 {
    public static void main(String[] args) {
        int[] ret = {1,2,3,4};
        String s = Arrays.toString(ret);
        System.out.println(s);
    }

    public static void main3(String[] args) {
        //数组是可以作为返回值的
        int[] ret = fun3();
        for (int i = 0; i < ret.length ; i++) {
            System.out.println(ret[i]);
        }
    }
    public static int[] fun3(){
        int[] ret = new int[2];
        ret[0] = 9;
        ret[1] = 199;
        return ret;
    }

    public static void main2(String[] args) {
        int[] array = {1,2,3,4};
        //func1(array);//打印99，2，3，4
        func2(array);//打印1，2，3，4
        for (int x:array) {
            System.out.println(x);
        }
    }
    public static void func1(int[] array){
        array[0] = 99;
    }

    public static void func2(int[] array){
        array = new int[]{11,22,33,44};
    }

    public static void main1(String[] args) {
        int[] array = {1,2,3};
        for(int i = 0; i<array.length;i++){
            System.out.println(array[i]+" ");
        }
    }
}
